<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
/**
 * BackendPro
 *
 * A website backend system for developers for PHP 4.3.2 or newer
 *
 * @package         conlabz CMS
 * @author          Christian Schneider
 * @copyright       Copyright (c) 2009
 * @license        
 * @link            http://www.conlabz.de
 * @filesource
 */

// ---------------------------------------------------------------------------

/**
 * Blog
 *
 * A website, usually maintained with regular entries of commentary
 *
 * @package         conlabz CMS
 * @subpackage      Controllers
 */
class Blog extends Public_Controller {
	function Blog( ) {
		parent::Public_Controller( );
	
    	$this->load->helper( 'url' );
		$this->load->helper( 'form' );
	}

	/**
	 * View Blog
	 *
	 * @access public
	 */
	function index( ) {
	  	$data['heading']    = "CMS-Blog";
	  	$data['blog_query']  = $this->db->get( 'blog' );
	  	$data['entry_query'] = $this->db->get( 'blog_entry' );
	    $data['page'] 	     = "/view_blog";
		$data['module']      = 'blog';
		
		$this->load->module_view( $data['module'], $data['page'], $data );
  	}

  	/**
	 * View Comments
	 *
	 * @access public
	 */ 
	 function Comments( ) {
		$data['headding'] = "Comments";
		
		$this->db->where( 'entry_id', $this->uri->segment( 3 ) );
		
		$data['query'] 	  = $this->db->get( 'blog_comment' );
		$data['page']     = "/view_comments";
		$data['module']   = 'blog';
		    
		$this->load->module_view( $data['module'], $data['page'], $data );
  	} 
	
  	/**
	 * View Blog entries
	 *
	 * @access public
	 */ 
  	function BlogEntry( ) {
  		$this->db->insert( 'blog_comment', $_POST );

    	redirect( 'blog/Comments/'.$_POST['entry_id'] );
  	}
}
/* End of file blog.php */
/* Location: ./modules/blog/controllers/blog.php */